Skip to content

Use ruff Python formatter #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

x0rw
Copy link
Contributor

@x0rw x0rw commented Jul 16, 2025

  • add GitHub Action to fail the build if not formatted according to ruff
  • tweak ruff settings as necessary
  • add to README.md about how to configure a contributor's ruff settings and/or (ideally) include those in the repo so that it "just works" for contributors

Resolves #146

Copy link

netlify bot commented Jul 16, 2025

Deploy Preview for scrc-coding-guidelines failed.

Name Link
🔨 Latest commit dab079c
🔍 Latest deploy log https://app.netlify.com/projects/scrc-coding-guidelines/deploys/6895b9e9c297db0008de98a9

@PLeVasseur
Copy link
Collaborator

Hi @x0rw -- is this still a draft or ready for review? I saw a couple of unticked boxes

@x0rw x0rw force-pushed the python-feature/ruff branch from 80d2e4c to e3ea946 Compare August 7, 2025 12:51
@x0rw
Copy link
Contributor Author

x0rw commented Aug 7, 2025

Hi @PLeVasseur,
This looks fine to me now, also there is no need for README.md explaination, as pyproject.toml is self explanatory and well commented.
Also every lint ignored in lint.ignore can be considered a TODO for us, but they require more manual testing because we don't have unit tests,

let me know what you think.

Copy link
Collaborator

@PLeVasseur PLeVasseur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @x0rw -- thanks for the updates! I left a couple of comments if you could take a look

pyproject.toml Outdated
@@ -19,3 +19,35 @@ members = ["builder"]

[tool.uv.sources]
builder = { workspace = true }

[tool.ruff]
# line-length = 88
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we remove some of the commented out code such as this line?
Or are you considering adding them back in and wanted to check with folks?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well it can be removed, we can't enfore line length because we have templates with long one-line strings.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could make exceptions for those and enforce it elsewhere?

pyproject.toml Outdated
"ruff>=0.12.3",
]

# [tool.ruff.mccabe]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious on if this is common and/or recommended as a metric for Python code when using ruff.
Did you have some thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max-complexity field under this ruff.mccabe, can be used to fine-tune the strictness of the cyclomatic complexity checks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But i think we don't need to go that far.

@felix91gr felix91gr added enhancement New feature or request ci/cd Related to CI/CD labels Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/cd Related to CI/CD enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Use ruff Python formatter
4 participants